package com.dianping.cat.home.dependency.graph.entity;

import com.dianping.cat.home.dependency.graph.BaseEntity;
import com.dianping.cat.home.dependency.graph.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;




public class TopologyGraph
  extends BaseEntity<TopologyGraph>
{
  private String m_id;
  private String m_type;
  private int m_status;
  private String m_des;
/*  18 */   private Map<String, TopologyNode> m_nodes = new LinkedHashMap();

  private Map<String, TopologyEdge> m_edges = new LinkedHashMap();






/*  27 */   public void accept(IVisitor visitor) { visitor.visitTopologyGraph(this); }


  public TopologyGraph addTopologyEdge(TopologyEdge topologyEdge) {
    this.m_edges.put(topologyEdge.getKey(), topologyEdge);
    return this;
  }

  public TopologyGraph addTopologyNode(TopologyNode topologyNode) {
    this.m_nodes.put(topologyNode.getId(), topologyNode);
/*  37 */     return this;
  }


  public boolean equals(Object obj) {
/*  42 */     if (obj instanceof TopologyGraph) {
/*  43 */       TopologyGraph _o = (TopologyGraph)obj;

/*  45 */       if (!equals(getId(), _o.getId())) {
/*  46 */         return false;
      }

/*  49 */       if (!equals(getType(), _o.getType())) {
/*  50 */         return false;
      }

/*  53 */       if (getStatus() != _o.getStatus()) {
/*  54 */         return false;
      }

/*  57 */       if (!equals(getDes(), _o.getDes())) {
/*  58 */         return false;
      }

/*  61 */       if (!equals(getNodes(), _o.getNodes())) {
/*  62 */         return false;
      }

/*  65 */       if (!equals(getEdges(), _o.getEdges())) {
/*  66 */         return false;
      }


/*  70 */       return true;
    }

/*  73 */     return false;
  }


/*  77 */   public TopologyEdge findTopologyEdge(String key) { return (TopologyEdge)this.m_edges.get(key); }



/*  81 */   public TopologyNode findTopologyNode(String id) { return (TopologyNode)this.m_nodes.get(id); }


  public TopologyEdge findOrCreateTopologyEdge(String key) {
/*  85 */     TopologyEdge topologyEdge = (TopologyEdge)this.m_edges.get(key);

/*  87 */     if (topologyEdge == null) {
/*  88 */       synchronized (this.m_edges) {
/*  89 */         topologyEdge = (TopologyEdge)this.m_edges.get(key);

/*  91 */         if (topologyEdge == null) {
/*  92 */           topologyEdge = new TopologyEdge(key);
/*  93 */           this.m_edges.put(key, topologyEdge);
        }
      }
    }

/*  98 */     return topologyEdge;
  }

  public TopologyNode findOrCreateTopologyNode(String id) {
/* 102 */     TopologyNode topologyNode = (TopologyNode)this.m_nodes.get(id);

/* 104 */     if (topologyNode == null) {
/* 105 */       synchronized (this.m_nodes) {
/* 106 */         topologyNode = (TopologyNode)this.m_nodes.get(id);

/* 108 */         if (topologyNode == null) {
/* 109 */           topologyNode = new TopologyNode(id);
/* 110 */           this.m_nodes.put(id, topologyNode);
        }
      }
    }

/* 115 */     return topologyNode;
  }


/* 119 */   public String getDes() { return this.m_des; }



/* 123 */   public Map<String, TopologyEdge> getEdges() { return this.m_edges; }



/* 127 */   public String getId() { return this.m_id; }



/* 131 */   public Map<String, TopologyNode> getNodes() { return this.m_nodes; }



/* 135 */   public int getStatus() { return this.m_status; }



/* 139 */   public String getType() { return this.m_type; }



  public int hashCode() {
/* 144 */     int hash = 0;

/* 146 */     hash = hash * 31 + ((this.m_id == null) ? 0 : this.m_id.hashCode());
/* 147 */     hash = hash * 31 + ((this.m_type == null) ? 0 : this.m_type.hashCode());
/* 148 */     hash = hash * 31 + this.m_status;
/* 149 */     hash = hash * 31 + ((this.m_des == null) ? 0 : this.m_des.hashCode());
/* 150 */     hash = hash * 31 + ((this.m_nodes == null) ? 0 : this.m_nodes.hashCode());
/* 151 */     return hash * 31 + ((this.m_edges == null) ? 0 : this.m_edges.hashCode());
  }




  public void mergeAttributes(TopologyGraph other) {
/* 158 */     if (other.getId() != null) {
/* 159 */       this.m_id = other.getId();
    }

/* 162 */     if (other.getType() != null) {
/* 163 */       this.m_type = other.getType();
    }

/* 166 */     this.m_status = other.getStatus();

/* 168 */     if (other.getDes() != null) {
/* 169 */       this.m_des = other.getDes();
    }
  }


/* 174 */   public TopologyEdge removeTopologyEdge(String key) { return (TopologyEdge)this.m_edges.remove(key); }



/* 178 */   public TopologyNode removeTopologyNode(String id) { return (TopologyNode)this.m_nodes.remove(id); }


  public TopologyGraph setDes(String des) {
/* 182 */     this.m_des = des;
/* 183 */     return this;
  }

  public TopologyGraph setId(String id) {
/* 187 */     this.m_id = id;
/* 188 */     return this;
  }

  public TopologyGraph setStatus(int status) {
/* 192 */     this.m_status = status;
/* 193 */     return this;
  }

  public TopologyGraph setType(String type) {
/* 197 */     this.m_type = type;
/* 198 */     return this;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/dependency/graph/entity/TopologyGraph.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */